﻿namespace Ycjw.PipeLine.Commons
{
    /// <summary>
    /// 类的扩展属性
    /// </summary>
    public static class PropertiesExtended
    {
        /// <summary>
        /// 实现类的深拷贝
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <returns></returns>

        #region

        public static T DataDeepClone<T>(this object obj) where T : class
        {
            T result = (T)obj;
            string json = Commons.SerializeHelper.JsonHepler.Json_SerializeObject(obj, true);
            result = Commons.SerializeHelper.JsonHepler.Json_DeserializeObject<T>(json);
            return result;
        }

        #endregion
    }
}